<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<!-- 开发环境版本，包含了有帮助的命令行警告 -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
		<title></title>
		<style>
			.box{
				width: 100px;
				height: 100px;
				background: green;
			}
			.red{
				width: 100px;
				height: 100px;
				background: red;
			}
		</style>
		<div id="app">
			<div v-bind:class="classObj" @click="change()">
			</div>
		</div>
	</head>
	<body>
		<script>
			new Vue({
				el:"#app",
				data:{
					normal:true,
					classObj:{
						box:true,
						red:false
						//red:true
					}
				},
				//加点击事件
				methods:{
					change:function(){
						this.classObj.red=!this.classObj.red
					}
				}
			})
		</script>
	</body>
</html>
